var sif_imagenodes = {};

function getVisualByPass(pathway, allnodes, searchterm){	
	var searchterm_id = "";
	var searchterm_type = "";
	var bypass = null;
	var nodes_visual = {};
	var borderColor = "gray";
	var borderWidth = 1;
	var xy = "";
	for (var i = 0; i < allnodes.length; i++){
		var node = allnodes[i];
		if (node.data.label.toUpperCase() == searchterm.toUpperCase()){
			borderColor = "gray";
			borderWidth = 1;
			searchterm_id = node.data.id;
			searchterm_type = node.data.NodeTypes;
			xy = ("" + node.x).split(".")[0] + "_" + ("" + node.y).split(".")[0]   
			break;
		}
		if (node.data.type != null && node.data.type == "gene"){
			var imageUrl = node.data.image;
			var spRxns = "";
			if (node.data.image.indexOf("RXN") != -1){
				spRxns = node.data.image.split(",");
				imageUrl = spRxns[0];
				imageUrl = imageUrl.split(".png")[0] + "_icon.png"; 
			}else{
				imageUrl = imageUrl.split(".png")[0] + "_icon.png";
			}
			nodes_visual[node.data.id] = {label:"", image:imageUrl, spRxns:spRxns, width:75, height:75, borderColor:borderColor, borderWidth:borderWidth};
			sif_imagenodes = nodes_visual;
		}
	}
        bypass = {
        nodes: {
		"cholesterol_19": { label:'', image:'images/cholesterol/19_CHSTEROLt_icon.png',borderWidth:borderWidth,borderColor:borderColor},
		"cholesterol_39": { label:'', image: 'images/cholesterol/39_ACACT1_icon.png',borderWidth:borderWidth,borderColor:borderColor},
		"cholesterol_1595": { label:'', image: 'images/cholesterol/1595_LNS14DMr_icon.png',borderWidth:borderWidth,borderColor:borderColor},
		"cholesterol_1717": { label:'', image: 'images/cholesterol/1717_DHCR71r_DHCR72r_icon.png',borderWidth:borderWidth,borderColor:borderColor},
		"cholesterol_1718": { label:'', image: 'images/cholesterol/1718_DHCR241r_DHCR242r_DHCR243r_icon.png',borderWidth:borderWidth,borderColor:borderColor},
		"cholesterol_2222": { label:'', image: 'images/cholesterol/2222_SQLSr_icon.png',borderWidth:borderWidth,borderColor:borderColor},
		"cholesterol_2224": { label:'', image: 'images/cholesterol/2224_DMATTx_GRTTx_icon.png',borderWidth:borderWidth,borderColor:borderColor},
		"cholesterol_3155": { label:'', image: 'images/cholesterol/3155_HMGLm_HMGLx_icon.png',borderWidth:borderWidth,borderColor:borderColor},
		"cholesterol_3156": { label:'', image: 'images/cholesterol/3156_HMGCOARx_icon.png',borderWidth:borderWidth,borderColor:borderColor},
		"cholesterol_3157": { label:'', image: 'images/cholesterol/3157_HMGCOASi_icon.png',borderWidth:borderWidth,borderColor:borderColor},
		"cholesterol_3158": { label:'', image: 'images/cholesterol/3158_HMGCOASim_icon.png',borderWidth:borderWidth,borderColor:borderColor},
		"cholesterol_6713": { label:'', image: 'images/cholesterol/6713_SQLE_rxn_SQLEr_icon.png',borderWidth:borderWidth,borderColor:borderColor},
		"cholesterol_3295": { label:'', image: 'images/cholesterol/3295_C3STKR2r_icon.png',borderWidth:borderWidth,borderColor:borderColor},
		"cholesterol_3422": { label:'', image: 'images/cholesterol/3422_IPDDIx_icon.png',borderWidth:borderWidth,borderColor:borderColor},
		"cholesterol_4047": { label:'', image: 'images/cholesterol/4047_LNSTLSr_icon.png',borderWidth:borderWidth,borderColor:borderColor},
		"cholesterol_4597": { label:'', image: 'images/cholesterol/4597_DPMVDx_icon.png',borderWidth:borderWidth,borderColor:borderColor},
		"cholesterol_4598": { label:'', image: 'images/cholesterol/4598_MEVK1x_icon.png',borderWidth:borderWidth,borderColor:borderColor},
		"cholesterol_6307": { label:'', image: 'images/cholesterol/6307_C4STMO1r_C4STMO2r_icon.png',borderWidth:borderWidth,borderColor:borderColor},
		"cholesterol_6309": { label:'', image: 'images/cholesterol/6309_LSTO1r_LSTO2r_icon.png',borderWidth:borderWidth,borderColor:borderColor},
		"cholesterol_6646": { label:'', image: 'images/cholesterol/6646_SOAT11_SOAT12_icon.png',borderWidth:borderWidth,borderColor:borderColor},
		"cholesterol_6713": { label:'', image: 'images/cholesterol/6713_SQLEr_icon.png',borderWidth:borderWidth,borderColor:borderColor},
		"cholesterol_7108": { label:'', image:'images/cholesterol/7108_C14STRr_icon.png',borderWidth:borderWidth,borderColor:borderColor},
		"cholesterol_8034": { label:'', image:'images/cholesterol/8034_COAtm_icon.png',borderWidth:borderWidth,borderColor:borderColor},
		"cholesterol_10654": { label:'', image: 'images/cholesterol/10654_PMEVKx_icon.png',borderWidth:borderWidth,borderColor:borderColor},
		"cholesterol_10682": { label:'', image: 'images/cholesterol/10682_EBP1r_EBP2r_icon.png',borderWidth:borderWidth,borderColor:borderColor},
		"cholesterol_50814": { label:'', image: 'images/cholesterol/50814_C3STDH1Pr_C3STDH1r_C4STMO2Pr_C4STMO2r_icon.png',borderWidth:borderWidth,borderColor:borderColor},
		"cholesterol_54511": { label:'', image:'images/cholesterol/54511_HMGLm_icon.png',borderWidth:borderWidth,borderColor:borderColor},
		"cholesterol_91734": { label:'', image: 'images/cholesterol/91734_IPDDIx_icon.png',borderWidth:borderWidth,borderColor:borderColor}
	}    
      };
	if (pathway == 'faa'){
		bypass = {
                        nodes: {
        			"faa_34": { label:"", image:'images/faa/34_FAOXC161802m_icon.png', width:75, height:75,borderWidth:borderWidth,borderColor:borderColor},
				"faa_35": { label:"", image:'images/faa/35_FAOXC161802m_icon.png', width:75, height:75,borderWidth:borderWidth,borderColor:borderColor},
				"faa_23305": { label:"", image:'images/faa/23305_rxns_icon.png', width:75, height:75,borderWidth:borderWidth,borderColor:borderColor},
				"faa_11001": { label:"", image:'images/faa/11001_FACOAL191_icon.png', width:75, height:75,borderWidth:borderWidth,borderColor:borderColor},
				"faa_51703": { label:"", image:'images/faa/51703_rxns_icon.png', width:75, height:75,borderWidth:borderWidth,borderColor:borderColor},
				"faa_2180": { label:"", image:'images/faa/2180_rxns_icon.png', width:75, height:75,borderWidth:borderWidth,borderColor:borderColor},
				"faa_2182": { label:"", image:'images/faa/2182_rxns_icon.png', width:75, height:75,borderWidth:borderWidth,borderColor:borderColor},
	                        "faa_116285": { label:"", image:'images/faa/116285_FACOAL40im_icon.png', width:75, height:75,borderWidth:borderWidth,borderColor:borderColor},
				"faa_2181": { label:"", image:'images/faa/2181_rxns_icon.png', width:75, height:75,borderWidth:borderWidth,borderColor:borderColor},
                                "faa_8034": { label:"", image:'images/faa/8034_COAtm_icon.png', width:75, height:75,borderWidth:borderWidth,borderColor:borderColor}
                        }
                };
	}
	if (pathway == 'fao'){
		bypass = {
        		nodes: {
         			"fao_34": { label:"", image:'images/fao/34_rxns_icon.png', width:75, height:75,borderWidth:borderWidth,borderColor:borderColor},
	 			"fao_35": { label:"", image:'images/fao/35_rxns_icon.png', width:75, height:75,borderWidth:borderWidth,borderColor:borderColor}
			}
		};
	}
	if (pathway.indexOf("_sif") != -1){
		bypass["nodes"] = nodes_visual;
        }
	
	if (pathway == 'tag'){
                bypass = {
                        nodes: {
                                "tag_8513": { label:"", image:'images/tag/8513_LPSe_icon.png', width:75, height:75,borderWidth:borderWidth,borderColor:borderColor},
                        	"tag_23175": { label:"", image:'images/tag/23175_PPAP_icon.png', width:75, height:75,borderWidth:borderWidth,borderColor:borderColor},
			        "tag_8694": { label:"", image:'images/tag/8694_DGAT_icon.png', width:75, height:75,borderWidth:borderWidth,borderColor:borderColor},
				"tag_84649": { label:"", image:'images/tag/84649_DGAT_icon.png', width:75, height:75,borderWidth:borderWidth,borderColor:borderColor},
				"tag_80168": { label:"", image:'images/tag/80168_MOGAT_icon.png', width:75, height:75,borderWidth:borderWidth,borderColor:borderColor},
                        	"tag_57678": { label:"", image:'images/tag/57678_GPAM_hs_icon.png', width:75, height:75,borderWidth:borderWidth,borderColor:borderColor},
                        	"tag_56895": { label:"", image:'images/tag/56895_AGPAT1_icon.png', width:75, height:75,borderWidth:borderWidth,borderColor:borderColor},
                        	"tag_56894": { label:"", image:'images/tag/56894_AGPAT1_icon.png', width:75, height:75,borderWidth:borderWidth,borderColor:borderColor},
				"tag_55326": { label:"", image:'images/tag/55326_AGPAT1_icon.png', width:75, height:75,borderWidth:borderWidth,borderColor:borderColor},
				"tag_5408": { label:"", image:'images/tag/5408_LPSe_icon.png', width:75, height:75,borderWidth:borderWidth,borderColor:borderColor},
				"tag_5407": { label:"", image:'images/tag/5407_LPSe_icon.png', width:75, height:75,borderWidth:borderWidth,borderColor:borderColor},
				"tag_5406": { label:"", image:'images/tag/5406_LPSe_icon.png', width:75, height:75,borderWidth:borderWidth,borderColor:borderColor},
                        	"tag_50487": { label:"", image:'images/tag/50487_LPS4e_icon.png', width:75, height:75,borderWidth:borderWidth,borderColor:borderColor},
                        	"tag_4023": { label:"", image:'images/tag/4023_LPS_LPS2_icon.png', width:75, height:75,borderWidth:borderWidth,borderColor:borderColor},
				"tag_3990": { label:"", image:'images/tag/3990_LPSe_icon.png', width:75, height:75,borderWidth:borderWidth,borderColor:borderColor},
				"tag_2819": { label:"", image:'images/tag/2819_G3PD1_icon.png', width:75, height:75,borderWidth:borderWidth,borderColor:borderColor},
				"tag_23175": { label:"", image:'images/tag/23175_PPAP_icon.png', width:75, height:75,borderWidth:borderWidth,borderColor:borderColor},	
				"tag_137964": { label:"", image:'images/tag/137964_AGPAT1_icon.png', width:75, height:75,borderWidth:borderWidth,borderColor:borderColor},
                        	"tag_116255": { label:"", image:'images/tag/116255_MOGAT_icon.png', width:75, height:75,borderWidth:borderWidth,borderColor:borderColor},
                        	"tag_11343": { label:"", image:'images/tag/11343_LPS3_icon.png', width:75, height:75,borderWidth:borderWidth,borderColor:borderColor},
                        	"tag_10555": { label:"", image:'images/tag/10555_AGPAT1_icon.png', width:75, height:75,borderWidth:borderWidth,borderColor:borderColor},
				"tag_10554": { label:"", image:'images/tag/10554_AGPAT1_icon.png', width:75, height:75,borderWidth:borderWidth,borderColor:borderColor},
				"tag_9388": { label:"", image:'images/tag/9388_LPSe_icon.png', width:75, height:75,borderWidth:borderWidth,borderColor:borderColor}
                        }
                };
        }
	if (pathway == "huvec_argpro"){
		bypass = {
			nodes:{
	 			'argpro_10165':{ label:'', image:'images/huvec/ArgProMet/10165_icon.png',borderWidth:borderWidth,borderColor:borderColor},
'argpro_10166':{ label:'', image:'images/huvec/ArgProMet/10166_icon.png',borderWidth:borderWidth,borderColor:borderColor},
'argpro_112483':{ label:'', image:'images/huvec/ArgProMet/112483_icon.png',borderWidth:borderWidth,borderColor:borderColor},
'argpro_113451':{ label:'', image:'images/huvec/ArgProMet/113451_icon.png',borderWidth:borderWidth,borderColor:borderColor},
'argpro_1610':{ label:'', image:'images/huvec/ArgProMet/1610_icon.png',borderWidth:borderWidth,borderColor:borderColor},
'argpro_216':{ label:'', image:'images/huvec/ArgProMet/216_icon.png',borderWidth:borderWidth,borderColor:borderColor},
'argpro_217':{ label:'', image:'images/huvec/ArgProMet/217_icon.png',borderWidth:borderWidth,borderColor:borderColor},
'argpro_219':{ label:'', image:'images/huvec/ArgProMet/219_icon.png',borderWidth:borderWidth,borderColor:borderColor},
'argpro_223':{ label:'', image:'images/huvec/ArgProMet/223_icon.png',borderWidth:borderWidth,borderColor:borderColor},
'argpro_224':{ label:'', image:'images/huvec/ArgProMet/224_icon.png',borderWidth:borderWidth,borderColor:borderColor},
'argpro_262':{ label:'', image:'images/huvec/ArgProMet/262_icon.png',borderWidth:borderWidth,borderColor:borderColor},
'argpro_26':{ label:'', image:'images/huvec/ArgProMet/26_icon.png',borderWidth:borderWidth,borderColor:borderColor},
'argpro_2805':{ label:'', image:'images/huvec/ArgProMet/2805_icon.png',borderWidth:borderWidth,borderColor:borderColor},
'argpro_2806':{ label:'', image:'images/huvec/ArgProMet/2806_icon.png',borderWidth:borderWidth,borderColor:borderColor},
'argpro_314':{ label:'', image:'images/huvec/ArgProMet/314_icon.png',borderWidth:borderWidth,borderColor:borderColor},
'argpro_4128':{ label:'', image:'images/huvec/ArgProMet/4128_icon.png',borderWidth:borderWidth,borderColor:borderColor},
'argpro_4129':{ label:'', image:'images/huvec/ArgProMet/4129_icon.png',borderWidth:borderWidth,borderColor:borderColor},
'argpro_4507':{ label:'', image:'images/huvec/ArgProMet/4507_icon.png',borderWidth:borderWidth,borderColor:borderColor},
'argpro_4842':{ label:'', image:'images/huvec/ArgProMet/4842_icon.png',borderWidth:borderWidth,borderColor:borderColor},
'argpro_4843':{ label:'', image:'images/huvec/ArgProMet/4843_icon.png',borderWidth:borderWidth,borderColor:borderColor},
'argpro_4844':{ label:'', image:'images/huvec/ArgProMet/4844_icon.png',borderWidth:borderWidth,borderColor:borderColor},
'argpro_4845':{ label:'', image:'images/huvec/ArgProMet/4845_icon.png',borderWidth:borderWidth,borderColor:borderColor},
'argpro_4846':{ label:'', image:'images/huvec/ArgProMet/4846_icon.png',borderWidth:borderWidth,borderColor:borderColor},
'argpro_501':{ label:'', image:'images/huvec/ArgProMet/501_icon.png',borderWidth:borderWidth,borderColor:borderColor},
'argpro_5033':{ label:'', image:'images/huvec/ArgProMet/5033_icon.png',borderWidth:borderWidth,borderColor:borderColor},
'argpro_5034':{ label:'', image:'images/huvec/ArgProMet/5034_icon.png',borderWidth:borderWidth,borderColor:borderColor},
'argpro_5625':{ label:'', image:'images/huvec/ArgProMet/5625_icon.png',borderWidth:borderWidth,borderColor:borderColor},
'argpro_5831':{ label:'', image:'images/huvec/ArgProMet/5831_icon.png',borderWidth:borderWidth,borderColor:borderColor},
'argpro_58510':{ label:'', image:'images/huvec/ArgProMet/58510_icon.png',borderWidth:borderWidth,borderColor:borderColor},
'argpro_6303':{ label:'', image:'images/huvec/ArgProMet/6303_icon.png',borderWidth:borderWidth,borderColor:borderColor},
'argpro_79751':{ label:'', image:'images/huvec/ArgProMet/79751_icon.png',borderWidth:borderWidth,borderColor:borderColor},
'argpro_79814':{ label:'', image:'images/huvec/ArgProMet/79814_icon.png',borderWidth:borderWidth,borderColor:borderColor},
'argpro_83733':{ label:'', image:'images/huvec/ArgProMet/83733_icon.png',borderWidth:borderWidth,borderColor:borderColor},
'argpro_83884':{ label:'', image:'images/huvec/ArgProMet/83884_icon.png',borderWidth:borderWidth,borderColor:borderColor},
'argpro_8402':{ label:'', image:'images/huvec/ArgProMet/8402_icon.png',borderWidth:borderWidth,borderColor:borderColor},
'argpro_8604':{ label:'', image:'images/huvec/ArgProMet/8604_icon.png',borderWidth:borderWidth,borderColor:borderColor},
'argpro_8639':{ label:'', image:'images/huvec/ArgProMet/8639_icon.png',borderWidth:borderWidth,borderColor:borderColor},
'argpro_8659':{ label:'', image:'images/huvec/ArgProMet/8659_icon.png',borderWidth:borderWidth,borderColor:borderColor},
'argpro_8854':{ label:'', image:'images/huvec/ArgProMet/8854_icon.png',borderWidth:borderWidth,borderColor:borderColor},
'argpro_8974':{ label:'', image:'images/huvec/ArgProMet/8974_icon.png',borderWidth:borderWidth,borderColor:borderColor} 			                      
			}
		};
	}
	if (pathway == 'valleuiso'){
		bypass = {
			nodes:{
				"valleuiso_18": { label:'', image:'images/valleuiso/18_3AIBTm_icon.png',borderWidth:borderWidth,borderColor:borderColor},
                 		"valleuiso_34": { label:'', image:'images/valleuiso/34_ACOAD10m_ACOAD9m_icon.png',borderWidth:borderWidth,borderColor:borderColor},
                 		"valleuiso_36": { label:'', image:'images/valleuiso/36_ACOAD10m_icon.png',borderWidth:borderWidth,borderColor:borderColor},
                 		"valleuiso_38": { label:'', image:'images/valleuiso/38_ACACT10m_icon.png',borderWidth:borderWidth,borderColor:borderColor},
                 		"valleuiso_549": { label:'', image:'images/valleuiso/549_MGCHrm_icon.png',borderWidth:borderWidth,borderColor:borderColor},
                 		"valleuiso_586": { label:'', image:'images/valleuiso/586_ILETA_LEUTA_VALTA_icon.png',borderWidth:borderWidth,borderColor:borderColor},
                 		"valleuiso_587": { label:'', image:'images/valleuiso/587_ILETAm_LEUTAm_VALTAm_icon.png',borderWidth:borderWidth,borderColor:borderColor},
                 		"valleuiso_593": { label:'', image:'images/valleuiso/593_OIVD1m_OIVD2m_OIVD3m_icon.png',borderWidth:borderWidth,borderColor:borderColor},
                 		"valleuiso_594": { label:'', image:'images/valleuiso/594_OIVD1m_OIVD2m_OIVD3m_icon.png',borderWidth:borderWidth,borderColor:borderColor},
                 		"valleuiso_1629": { label:'', image:'images/valleuiso/1629_OIVD1m_OIVD2m_OIVD3m_icon.png',borderWidth:borderWidth,borderColor:borderColor},
                 		"valleuiso_1738": { label:'', image:'images/valleuiso/1738_OIVD1m_OIVD2m_OIVD3m_icon.png',borderWidth:borderWidth,borderColor:borderColor},
                 		"valleuiso_1892": { label:'', image:'images/valleuiso/1892_ECOAH12m_ECOAH9m_icon.png',borderWidth:borderWidth,borderColor:borderColor},
                 		"valleuiso_3028": { label:'', image:'images/valleuiso/3028_HACD9m_icon.png',borderWidth:borderWidth,borderColor:borderColor},
                 		"valleuiso_3030": { label:'', image:'images/valleuiso/3030_ECOAH12m_ECOAH9m_icon.png',borderWidth:borderWidth,borderColor:borderColor},
               		  	"valleuiso_3032": { label:'', image:'images/valleuiso/3032_ECOAH12m_ECOAH9m_icon.png',borderWidth:borderWidth,borderColor:borderColor},
                 		"valleuiso_3155": { label:'', image:'images/valleuiso/3155_HMGLm_icon.png',borderWidth:borderWidth,borderColor:borderColor},
                 		"valleuiso_3712": { label:'', image:'images/valleuiso/3712_ACOAD8m_icon.png',borderWidth:borderWidth,borderColor:borderColor},
                 		"valleuiso_4329": { label:'', image:'images/valleuiso/4329_MMSAD1m_icon.png',borderWidth:borderWidth,borderColor:borderColor},
                 		"valleuiso_4594": { label:'', image:'images/valleuiso/4594_MMMm_icon.png',borderWidth:borderWidth,borderColor:borderColor},
                 		"valleuiso_5095": { label:'', image:'images/valleuiso/5095_PPCOACm_icon.png',borderWidth:borderWidth,borderColor:borderColor},
                 		"valleuiso_5096": { label:'', image:'images/valleuiso/5096_PPCOACm_icon.png',borderWidth:borderWidth,borderColor:borderColor},
                 		"valleuiso_8034": { label:'', image:'images/valleuiso/8034_COAtm_icon.png',borderWidth:borderWidth,borderColor:borderColor},
                 		"valleuiso_11112": { label:'', image:'images/valleuiso/11112_HIBDm_icon.png',borderWidth:borderWidth,borderColor:borderColor},
                 		"valleuiso_23417": { label:'', image:'images/valleuiso/23417_MMCDm_icon.png',borderWidth:borderWidth,borderColor:borderColor},
                 		"valleuiso_27034": { label:'', image:'images/valleuiso/27034_ACOAD9m_icon.png',borderWidth:borderWidth,borderColor:borderColor},
                 		"valleuiso_56922": { label:'', image:'images/valleuiso/56922_MCCCrm_icon.png',borderWidth:borderWidth,borderColor:borderColor},
                 		"valleuiso_54511": { label:'', image:'images/valleuiso/54511_HMGLm_icon.png',borderWidth:borderWidth,borderColor:borderColor},
                 		"valleuiso_64064": { label:'', image:'images/valleuiso/64064_OCOAT1m_icon.png',borderWidth:borderWidth,borderColor:borderColor},
                 		"valleuiso_64087": { label:'', image:'images/valleuiso/64087_MCCCrm_icon.png',borderWidth:borderWidth,borderColor:borderColor},
                 		"valleuiso_84693": { label:'', image:'images/valleuiso/84693_MMEm_icon.png',borderWidth:borderWidth,borderColor:borderColor},
				"valleuiso_5019": { label:'', image:'images/valleuiso/5019_OCOAT1m_icon.png',borderWidth:borderWidth,borderColor:borderColor}
			}
		};
	}
	//init nongene visual bypass nodes
	if (searchterm_type != "" && searchterm_type != "gene"){
		bypass.nodes[searchterm_id] = {};		
	}

	if (searchterm_id != ""){
                bypass.nodes[searchterm_id].borderColor = searchtype_color[searchterm_type];
                bypass.nodes[searchterm_id].borderWidth = 5;
                new Messi("Found " + searchterm_type + "_" + searchterm + " at position " + xy + " border is colored " + searchtype_color[searchterm_type], {title:"Found", titleClass:'info', autoclose:2500});
        }else if (searchterm_id == "" && searchterm != ""){
                new Messi(searchterm + " not in " + pathway, {title:"NotFound", titleClass:'info', autoclose:2000});
        }
      return bypass;
}
